$(function(){
	$('.zb_lst5 li:nth-child(3n)').css('margin-right','0');
	$('.movlst2 li:nth-child(3n)').css('margin-right','0');
	
	if($(".teach_rmtp .areab .txtp").height()>=70){
		$(".teach_rmtp .areab .txtp").css("height",66)
		$(".zdico").css("display","inline-block");
		$(".zdico").toggle(function(){
			$(".teach_rmtp .areab .txtp").css("height","auto");
			$(this).html("<span class='zdico_up'></span> 收起");
		},function(){
			$(".teach_rmtp .areab .txtp").css("height","66px");
			$(this).html("<span class='zdico_down'></span> 展开");
		})
	}

	$(".tjlst .blue").click(function(){
		var valTxt = $(this).parents("li").find(".link_txt").text();
		//console.log(valTxt);
		$(this).parents("li").html("<input type='text' class='text_input text_wid6' value="+valTxt+"> <a href='#' class='green_btn white'>保存</a></li>")
	})
	
	selectYear();
	movLength($('.movlst'));
})

function editBtn(thisObj){
	var pareObj = $(thisObj).parents(".duarea");
	pareObj.find(".addbtn").css("display","inline-block");
	pareObj.find(".mkfi").css("display","inline-block");
}


function selectYear(){
	var  d = new Date()
	var yearNum = d.getFullYear()		
	$(".selectsty select").each(function(){
		var thisObj = $(this);
		var startObj = $(this).attr("data-value");
		if(thisObj.hasClass("yearsNum")){
			for(var i=yearNum; i>yearNum-30; i--){
				if(i == startObj){
					thisObj.append("<option value='"+i+"' selected = 'selected'>"+i+"</option>");  //为Select追加一个Option(下拉项)
				}else{
					thisObj.append("<option value='"+i+"'>"+i+"</option>");
				}
			}
		}else if(thisObj.hasClass("mooNum")){
			for(var i=12; i>0; i--){
				if(i == startObj){
					thisObj.append("<option value='"+i+"' selected = 'selected'>"+i+"</option>");  //为Select追加一个Option(下拉项)
				}else{
					thisObj.append("<option value='"+i+"'>"+i+"</option>");
				}
			}
		}
	})
}

function movLength(thisObj){
	var lstNum = thisObj.find("li").length;
	if(lstNum>6){
		thisObj.find("li:last").css("display","none");
	}else{
		thisObj.find("li:last").css("display","block");	
	}
	
}

function movFn(movAdd){
	//var s = movAdd;
	// wNum = s.replace(/width\=['"]\d+['"]/,'width="680"');
	$("#movPop").css("display","none");
	$("#movPop").css("display","block");
	var movPlay = '<embed src="'+movAdd+'" allowFullScreen="true" quality="high" width="680" height="400" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash"></embed>'
	$("body").append('<div class="zmask"></div>');
	$("#movpop_ct").html("");
	$("#movpop_ct").html(movPlay);	
	$("#movPop .del-icon").click(function(){
		$("#movpop_ct").html("");
		$("#movPop").css("display","none");
		$(".zmask").remove();
	})
}

function tabxFn(thisObj,thisObj2,widNum){

	var thisTop = $(thisObj).offset().top;
	$(window).scroll(function(){
		//var rect = $(thisObj)[0].getBoundingClientRect();
		//var clientTop = document.documentElement.clientTop;
		var windowTop = $(window).scrollTop();
		if($(thisObj2).length>0){
			var thisTop2 = $(thisObj2).offset().top;
			if(windowTop>=thisTop2){	
				$(thisObj).css({"position":"static","top":"auto","width":"auto","z-index":"auto"})			
			}else{
				if(windowTop>=thisTop){
					$(thisObj).css({"position":"fixed","top":0,"width":widNum,"z-index":200})
				}else if(windowTop<thisTop){
					$(thisObj).css({"position":"static","top":"auto","width":"auto","z-index":"auto"})
				}			
			}						
		}else{
			if(windowTop>=thisTop && $("body").height()-$(window).height()>windowTop){
				$(thisObj).css({"position":"fixed","top":0,"width":widNum,"z-index":200})
 			}else if(windowTop<thisTop-90){
                $(thisObj).css({"position":"static","top":"auto","width":"auto","z-index":"auto"})

			}				
		}
	})	
}









